package Utils;
import net.sf.jml.message.MsnInstantMessage;
/*
 * Wrote by GnuFabio
 */
public class HtmlParser {
    private String str2ret = "<html></body></body></html>";

    public String getParsedMessage(MsnInstantMessage message){
        if(message.isBold() && !message.isItalic() && !message.isUnderline()){ //Opzione Bold attiva
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br> <b>" + message.getContent() + "</b><br>");
        } else if(!message.isBold() && !message.isItalic() && !message.isUnderline()){ //Nessuna opzione
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br>" + message.getContent() + "<br>");
        } else if(!message.isBold() && message.isItalic() && !message.isUnderline()){ //Opzopme italic attiva
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br> <i>" + message.getContent() + "</i><br>");
        } else if(!message.isBold() && !message.isItalic() && message.isUnderline()){ //Opzione underline attiva
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br> <u>" + message.getContent() + "</u><br>");
        } else if(message.isBold() && message.isItalic() && !message.isUnderline()){ //Bold + italic
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br><i><b>" + message.getContent() + "</b></i><br>");
        }else if(!message.isBold() && message.isItalic() && message.isUnderline()){ //Italic + underline
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br> <i><u>" + message.getContent() + "</i></u><br>");
        }else if(message.isBold() && !message.isItalic() && message.isUnderline()){ //Bold + underline
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br> <b><u>" + message.getContent() + "</b></u><br>");
        }else if(message.isBold() && message.isItalic() && message.isUnderline()){ //Tutte le opzioni attive
            str2ret = str2ret.replace("</body></html>","<b>"+message.getDisplayName()+"</b>" + " scrive: <br> <b><u><i>" + message.getContent() + "</i></b></u><br>");
        }
        return str2ret;
    }
}
